import React from 'react';
// 定义轮播图组件
import { Swiper } from 'antd-mobile';
const Myswiper = (props, ref) => {
    // console.log('props', props);
    const { swiperArr, changeVisibleFn } = props;
    // console.log('changeVisibleFn', changeVisibleFn);
    return (
        <>
            {
                swiperArr.length > 0 ? <Swiper autoplay autoplayInterval={1000} loop>
                    {
                        swiperArr.map((item, index) => <Swiper.Item key={item.bannerid} onClick={() => {
                            // 点击显示图片预览 
                            changeVisibleFn()
                        }}>
                            <img style={{ width: '100%' }} src={item.img} />
                        </Swiper.Item>)
                    }
                </Swiper> : <></>
            }
        </>
    );
}

export default Myswiper;
